package delegate

import kotlin.properties.Delegates

class User {
    var name: String by Delegates.observable("初始值") {
        prop, old, new ->
        println("prop: $prop, old: $old, new: $new")
    }
}

fun main() {
    val user = User()
    user.name = "第一次赋值"
    user.name = "第二次赋值"
}